<?php

namespace app\zucai\admin;

use app\admin\controller\Admin;
use app\common\builder\ZBuilder;
use think\Db;

/**
 * zucai 后台模块
 */
class Kaijiang extends Admin
{
    /**
     * 开奖记录首页 吴杰
     * @return mixed
     * @throws \think\Exception
     * @throws \think\exception\DbException
     */
    public function index()
    {
        $data_list = Db::name('kaijiang')->where($this->getMap())
            ->alias('a')
            ->join('zc_play b', 'a.play_id=b.id')
            ->order('b.id desc')
            ->paginate();

        return ZBuilder::make('table')
            ->hideCheckbox()
            ->setTableName('kaijiang')
            ->addColumns([
                ['__INDEX__', '序号'],
                ['id', '比赛数据','link',url('play/edit',['id'=>'__id__'])],
                ['team', '主场队伍'],
                ['team2', '客场队伍'],
                //['half', '半场比分'],
                ['score', '比分'],
                ['score_money', '比分奖金'],
                ['win', '胜平负结果'],
                ['win_money', '胜平负奖金'],
                ['rwin', '让球胜平负结果'],
                ['rwin_money', '让球胜平负奖金'],
                ['goal', '总进球数'],
                ['goal_money', '总进球奖金'],
                ['doub', '半全场胜负平结果'],
                ['double_money', '半全场胜平负奖金'],
                ['opentime', '开奖时间'],
            ])
            ->setRowList($data_list)
            ->setColumnWidth('rwin,rwin_money,double_money,doub', 130)
            ->setColumnWidth('opentime', 160)
            ->setColumnWidth('team,team2', 120)
            ->setColumnWidth('__INDEX__,score', 60)
            ->setColumnWidth('goal', 80)
            ->fetch();
    }
}